#!/bin/bash
#
# name: create_trial_account.sh
# auth: doctype <https://t.me/ndiey>
# desc:
##
clear

if [ "${EUID}" -ne 0 ]; then
    echo "You need to run this script as root" && exit 1
fi

getUsername=$( </dev/urandom tr -dc A-Z | head -c5 )
getPassword=$( </dev/urandom tr -dc 0-9 | head -c5 )
activeTime="1"
expireDate=$(date -d "$activeTime days" +"%Y-%m-%d")
useradd -e `date -d "$activeTime days" +"%Y-%m-%d"` -s /bin/false -M $getUsername
echo -e "$getPassword\n$getPassword" | passwd $getUsername &>/dev/null

clear
echo
echo "========================== [ ACCOUNT DETAIL ]"
echo "  Address: $GETIP"
echo " hostname: $GETHOST"
echo " Username: $getUsername"
echo " Password: $getPassword"
echo " Duration: $activeTime days"
echo "  Expired: $expireDate"
echo "---------------------------------------------"
echo "Copyright 2021 Cybertize, Allright Reserved."
echo "============================================="
echo
